<script lang="ts" setup>
import { useRouter } from '@/router';
import { onMounted, ref } from 'vue';
import { getHelp } from '@/api/car';
import { useLocale } from '@/locale/locale';
import { isWechat } from '@/utils/platform';

const { t } = useLocale();
const router = useRouter();
const statusBarH = ref(0);
const content = ref('');

async function getHelpInfo() {
  const res = await getHelp();
  if (res.code == 0) {
    content.value = res.data.info ? res.data.info.content : '';
  }
}

onMounted(async () => {
  uni.getSystemInfo({
    success: (res) => {
      statusBarH.value = res.statusBarHeight || 0;
    }
  });

  await getHelpInfo();
});
</script>

<template>
  <uni-nav-bar
    v-if="isWechat()"
    :border="false"
    :title="t('TransferCar')"
    fixed
    left-icon="left"
    shadow
    status-bar
    @click-left="router.back"
  />
  <view :style="{ minHeight: 'calc(100vh - 44px - ' + statusBarH + 'px)' }" class="help-contain">
    <uv-parse :content="content"></uv-parse>
  </view>
</template>

<style lang="scss" scoped>
.help-contain {
  width: 100%;
  background: #fff;
  font-size: 24rpx;
  padding-bottom: 0;
  padding-bottom: constant(safe-area-inset-bottom);
  padding-bottom: env(safe-area-inset-bottom);
}
</style>
